package com.ruoyi.custservice.service.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;

import com.ruoyi.bizsys.domain.ExtMonnifyReservedAccounts;
import com.ruoyi.bizsys.domain.ExtPaystackReservedAccounts;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.custservice.domain.ExtMonnifyReservedAccountsRsp;
import com.ruoyi.custservice.domain.RepaymentVa;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.custservice.mapper.ReservedAccountsMapper;
import com.ruoyi.custservice.service.ReservedAccountsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * monnify虚拟账户Service业务层处理
 *
 * @author african-loan
 * @date 2022-03-25
 */
@Service
public class ReservedAccountsServiceImpl implements ReservedAccountsService {

    @Autowired
    private ReservedAccountsMapper reservedAccountsMapper;
    /**
     * 查询monnify虚拟账户列表
     *
     * @param extMonnifyReservedAccounts monnify虚拟账户
     * @return monnify虚拟账户
     */
    /*@Override
    public List<ExtMonnifyReservedAccountsRsp> selectExtMonnifyReservedAccountsList(ExtMonnifyReservedAccountsRsp extMonnifyReservedAccounts) {
        QueryWrapper<ExtMonnifyReservedAccountsRsp> extMonnifyReservedAccountsQueryWrapper = new QueryWrapper<>();
        String bvn = extMonnifyReservedAccounts.getBvn();
        String customerName = extMonnifyReservedAccounts.getCustomerName();
        extMonnifyReservedAccountsQueryWrapper.select("id","customer_name","bvn","accounts_bank_name","accounts_account_number","accounts_account_name");
            extMonnifyReservedAccountsQueryWrapper.likeLeft(StringUtils.isNotBlank(bvn),"bvn",bvn);
            extMonnifyReservedAccountsQueryWrapper.eq(StringUtils.isNotBlank(customerName),"customer_name",customerName);
        List<ExtMonnifyReservedAccountsRsp> reservedAccountsList = reservedAccountsMapper.selectList(extMonnifyReservedAccountsQueryWrapper);
        return reservedAccountsList;
    }*/
    @Override
    public List<RepaymentVa> findListByParam(ExtMonnifyReservedAccountsRsp extMonnifyReservedAccounts) {
        List<RepaymentVa> repaymentVaList = new ArrayList<>();
        List<RepaymentVa> listByMonnify = reservedAccountsMapper.findListByParams(extMonnifyReservedAccounts);
        List<RepaymentVa> listByPaystack = reservedAccountsMapper.findListByPaystack(extMonnifyReservedAccounts);
        repaymentVaList.addAll(listByMonnify);
        repaymentVaList.addAll(listByPaystack);
        return repaymentVaList;
    }

}
